package com.smartpro.mis.modular.business.controller;

import com.smartpro.mis.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
//import com.smartpro.mis.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.smartpro.mis.modular.system.model.Performance;
import com.smartpro.mis.modular.business.service.IPerformanceService;

/**
 * 绩效控制器
 *
 * @author fengshuonan
 * @Date 2019-05-07 21:49:35
 */
@Controller
@RequestMapping("/performance")
public class PerformanceController extends BaseController {

    @Autowired
    private IPerformanceService performanceService;


    /**
     * 获取rest列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return performanceService.selectList(null);
    }

    /**
     * 新增rest
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add(Performance performance) {
        performanceService.insert(performance);
        return SUCCESS_TIP;
    }

    /**
     * 删除rest
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer performanceId) {
        performanceService.deleteById(performanceId);
        return SUCCESS_TIP;
    }

    /**
     * 修改rest
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(Performance performance) {
        performanceService.updateById(performance);
        return SUCCESS_TIP;
    }

    /**
     * rest详情
     */
    @RequestMapping(value = "/detail/{performanceId}")
    @ResponseBody
    public Object detail(@PathVariable("performanceId") Integer performanceId) {
        return performanceService.selectById(performanceId);
    }
}
